package kxfang.com.food.adapter;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.databinding.DataBindingUtil;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

import kxfang.com.common.bean.LifeClassModel;
import kxfang.com.food.R;
import kxfang.com.food.databinding.FoodHomeLayoutGridItemBinding;

/**
 * Created by ZJ
 * on 2020/5/30
 * Class Content 分类适配器
 */
public class LifeClassAdapter extends BaseQuickAdapter<LifeClassModel, BaseViewHolder> {

    public LifeClassAdapter() {
        super(R.layout.food_home_layout_grid_item);
    }

    @Override
    protected void onItemViewHolderCreated(@NotNull BaseViewHolder viewHolder, int viewType) {
        DataBindingUtil.bind(viewHolder.itemView);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, @Nullable LifeClassModel lifeClassModel) {
        if (lifeClassModel == null){
            return;
        }
        FoodHomeLayoutGridItemBinding binding = baseViewHolder.getBinding();
        if (binding != null){
            binding.setModel(lifeClassModel);
        }
    }
}
